<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
//    function A(name){

//    }


    // class A {
    //     currentDate(){
    //         return 1+2
    //     }
    // }
    // class B extends A{
    //     constructor(props){
    //         super(props)
    //     }
    // }
    // console.log(new B().currentDate())


    // function person (name) {
    // this.name = name
    // }
    
    // function child (sex,name) {
    //     this.sex = sex
    //     person.call(this,name)
    // }

    // let p = new child('浩天','男')
    // console.log(p);

    console.log(1)
    new Promise((resolve,reject)=>{
        setTimeout(()=>{
            resolve('成功')
            reject('失败')
            console.log(2)
        },0)
    }).then((data)=>{
        console.log(data)
    }).catch((err)=>{
        console.log(err)
    })
    console.log(3)

    async function test(){
        try{
            let res = await new Promise((resolve,reject)=>{
                setTimeout(()=>{
                    // resolve([1,2,3])
                    reject('失败了')
                },0)
            })
            console.log(res)
        }catch(err){
            console.log(err)
        }
    }
    test()
</script>